public class UndertowWebSocketSession extends AbstractListenerWebSocketSession<WebSocketChannel>
WebSocketSession
implementation that adapts to an Undertow
io.undertow.websockets.core.WebSocketChannel
.Modifier and Type | Class and Description |
---|---|
private class |
UndertowWebSocketSession.SendProcessorCallback |
AbstractListenerWebSocketSession.WebSocketSendProcessor
Constructor and Description |
---|
UndertowWebSocketSession(WebSocketChannel channel,
HandshakeInfo info,
DataBufferFactory factory) |
UndertowWebSocketSession(WebSocketChannel channel,
HandshakeInfo info,
DataBufferFactory factory,
<any> completionMono) |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canSuspendReceiving()
Whether the underlying WebSocket API has flow control and can suspend and
resume the receiving of messages.
|
<any> |
close(CloseStatus status)
Close the WebSocket session with the given status.
|
protected void |
resumeReceiving()
Resume receiving new message(s) after demand is generated by the
downstream Subscriber.
|
protected boolean |
sendMessage(WebSocketMessage message)
Send the given WebSocket message.
|
protected void |
suspendReceiving()
Suspend receiving until received message(s) are processed and more demand
is generated by the downstream Subscriber.
|
getSendProcessor, handleClose, handleError, handleMessage, onComplete, onError, onNext, onSubscribe, receive, send
binaryMessage, bufferFactory, getDelegate, getHandshakeInfo, getId, pingMessage, pongMessage, textMessage, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
close
public UndertowWebSocketSession(WebSocketChannel channel, HandshakeInfo info, DataBufferFactory factory)
public UndertowWebSocketSession(WebSocketChannel channel, HandshakeInfo info, DataBufferFactory factory, @Nullable <any> completionMono)
protected boolean canSuspendReceiving()
AbstractListenerWebSocketSession
Note: Sub-classes are encouraged to start out in suspended mode, if possible, and wait until demand is received.
canSuspendReceiving
in class AbstractListenerWebSocketSession<WebSocketChannel>
protected void suspendReceiving()
AbstractListenerWebSocketSession
Note: if the underlying WebSocket API does not provide
flow control for receiving messages, this method should be a no-op
and AbstractListenerWebSocketSession.canSuspendReceiving()
should return false
.
suspendReceiving
in class AbstractListenerWebSocketSession<WebSocketChannel>
protected void resumeReceiving()
AbstractListenerWebSocketSession
Note: if the underlying WebSocket API does not provide
flow control for receiving messages, this method should be a no-op
and AbstractListenerWebSocketSession.canSuspendReceiving()
should return false
.
resumeReceiving
in class AbstractListenerWebSocketSession<WebSocketChannel>
protected boolean sendMessage(WebSocketMessage message) throws java.io.IOException
AbstractListenerWebSocketSession
Note: Sub-classes are responsible for releasing the payload data buffer, once fully written, if pooled buffers apply to the underlying container.
sendMessage
in class AbstractListenerWebSocketSession<WebSocketChannel>
java.io.IOException
public <any> close(CloseStatus status)
WebSocketSession
status
- the close status